package com.prs.crm.domain.doc;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.FlowCodeEntity;
import com.prs.crm.domain.oa.Apply;
import com.prs.crm.domain.oa.JobPlan;
import com.prs.crm.domain.oa.OaTask;
import com.prs.crm.domain.oa.OaTaskKeyWord;
import com.prs.crm.domain.oa.OaTaskSubmit;
import com.prs.crm.domain.oa.Schedule;
import com.prs.crm.domain.pm.PmProject;
import com.prs.crm.domain.pm.PmStage;

@Entity
@Table(name = "doc_document")
public class Document extends FlowCodeEntity{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	private String name;
	private String keyWord;
	@ManyToOne
	private DocType type;
	@ManyToOne(fetch = FetchType.LAZY)
	@Cascade( { org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Attachment attach;
	@Lob
	private String summary;
	@ManyToOne
	private PmProject project;
	@ManyToOne
	private PmStage stage;
	@ManyToOne
	private OaTask oaTask;// 任务
	@ManyToOne
	private Apply apply;// 公务
	@ManyToOne
	private JobPlan jobPlan;// 计划
	@ManyToOne
	private Schedule oaSchedule;//
	@ManyToOne
	private OaTaskSubmit oaTaskSubmit;
	private String state;
	private String documentcode;
	@ManyToOne
	private DocLevel level;
	@ManyToMany(fetch = FetchType.LAZY)
	private Set<OaTaskKeyWord> oaTaskKeyWord = new HashSet<OaTaskKeyWord>();
	/**
	 * 新建任务文档
	 * 
	 * @return
	 */
	@Column(columnDefinition = "Integer(11) default '10'")
	private int newTask;
	/**
	 * 文档注解
	 */
	@Lob
	private String docuentRemark;

	
	public Set<OaTaskKeyWord> getOaTaskKeyWord() {
		return oaTaskKeyWord;
	}

	public void setOaTaskKeyWord(Set<OaTaskKeyWord> oaTaskKeyWord) {
		this.oaTaskKeyWord = oaTaskKeyWord;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public DocType getType() {
		return type;
	}

	public void setType(DocType type) {
		this.type = type;
	}

	public Attachment getAttach() {
		return attach;
	}

	public void setAttach(Attachment attach) {
		this.attach = attach;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public PmProject getProject() {
		return project;
	}

	public void setProject(PmProject project) {
		this.project = project;
	}

	public PmStage getStage() {
		return stage;
	}

	public void setStage(PmStage stage) {
		this.stage = stage;
	}

	public OaTask getOaTask() {
		return oaTask;
	}

	public void setOaTask(OaTask oaTask) {
		this.oaTask = oaTask;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getDocumentcode() {
		return documentcode;
	}

	public void setDocumentcode(String documentcode) {
		this.documentcode = documentcode;
	}

	public DocLevel getLevel() {
		return level;
	}

	public void setLevel(DocLevel level) {
		this.level = level;
	}

	public void setOaTaskSubmit(OaTaskSubmit oaTaskSubmit) {
		this.oaTaskSubmit = oaTaskSubmit;
	}

	public OaTaskSubmit getOaTaskSubmit() {
		return oaTaskSubmit;
	}

	public Schedule getOaSchedule() {
		return oaSchedule;
	}

	public void setOaSchedule(Schedule oaSchedule) {
		this.oaSchedule = oaSchedule;
	}

	public JobPlan getJobPlan() {
		return jobPlan;
	}

	public void setJobPlan(JobPlan jobPlan) {
		this.jobPlan = jobPlan;
	}

	public String getKeyWord() {
		return keyWord;
	}

	public void setKeyWord(String keyWord) {
		this.keyWord = keyWord;
	}

	public Apply getApply() {
		return apply;
	}

	public void setApply(Apply apply) {
		this.apply = apply;
	}

	public int getNewTask() {
		return newTask;
	}

	public void setNewTask(int newTask) {
		this.newTask = newTask;
	}

	public String getDocuentRemark() {
		return docuentRemark;
	}

	public void setDocuentRemark(String docuentRemark) {
		this.docuentRemark = docuentRemark;
	}


}
